/*
 * @Author: Wxx
 * @Date: 2022-03-01 16:40:12
 * @LastEditors: Wxx
 * @LastEditTime: 2022-03-01 16:45:57
 * @Description:
 */
import React, { Component, Suspense } from "react";

const Nowplaying = React.lazy(() => import("./Components/Nowplaying"));
const Commingsoon = React.lazy(() => import("./Components/Commingsoon"));
export default class App extends Component {
  state = {
    type: 1,
  };
  render() {
    return (
      <div>
        <button
          onClick={() => {
            this.setState({
              type: 1,
            });
          }}
        >
          即将上印
        </button>
        <button
          onClick={() => {
            this.setState({
              type: 2,
            });
          }}
        >
          正在热映
        </button>
        <Suspense fallback={<div>加载中...</div>}>
          {this.state.type === 1 ? <Nowplaying /> : <Commingsoon />}
        </Suspense>
      </div>
    );
  }
}
